home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / Barrier.h,v < prev    next >
Text File  |  1989-02-23  |  3KB  |  204 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.32.07;  author grunwald;  state Exp;
  11. branches ;
  12. next     3.1;
  13.  
  14. 3.1
  15. date     88.12.20.13.49.32;  author grunwald;  state Exp;
  16. branches ;
  17. next     1.3;
  18.  
  19. 1.3
  20. date     88.10.30.13.05.33;  author grunwald;  state Exp;
  21. branches ;
  22. next     1.2;
  23.  
  24. 1.2
  25. date     88.09.28.22.13.39;  author grunwald;  state Exp;
  26. branches ;
  27. next     1.1;
  28.  
  29. 1.1
  30. date     88.09.18.16.42.02;  author grunwald;  state Exp;
  31. branches ;
  32. next     ;
  33.  
  34.  
  35. desc
  36. @@
  37.  
  38.  
  39. 3.2
  40. log
  41. @Start using Gnu library heaps for schedulers
  42. @
  43. text
  44. @// This may look like C code, but it is really -*- C++ -*-
  45. // 
  46. // Copyright (C) 1988 University of Illinois, Urbana, Illinois
  47. //
  48. // written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
  49. //
  50. #ifndef Barrier_h
  51. #define Barrier_h
  52.  
  53. //
  54. //    Barrier.h
  55. //    The barrier is initially closed.
  56. // 
  57.  
  58. #include "ReserveByException.h"
  59. #include "FifoScheduler.h"
  60. #include "SpinLock.h"
  61.  
  62. class Barrier : public ReserveByException {
  63.     SpinLock lock;
  64.     short pHeight;
  65.     short pCount;
  66.     short pLoops;
  67.     short generation;
  68.  
  69.     FifoScheduler pPileOfThreads;
  70.     
  71.     void releaseAll();
  72.     
  73. private:
  74.     virtual bool reserveByException(Thread *byWho);
  75.     
  76. public:
  77.     
  78.     Barrier(int height, int loops = DefaultBarrierLoops);
  79.     virtual ~Barrier();
  80.  
  81.     void rendezvous();
  82.  
  83.     //
  84.     // lowerBarrier forces all waiting jobs to continue
  85.     //
  86.     void lowerBarrier();
  87.  
  88.     //
  89.     // Changing the height of the barrier can cause people to continue
  90.     // if it is lowered below the current pCount.
  91.     //
  92.     int height();
  93.     void height(int h);
  94. };
  95.  
  96. inline
  97. Barrier::Barrier( int h, int l )
  98. {
  99.     pHeight = h;
  100.     pLoops = l;
  101.     pCount = 0;
  102.     generation = 0;
  103. }
  104.  
  105. inline int
  106. Barrier::height()
  107. {
  108.     return(pHeight);
  109. }
  110.  
  111. #endif /* Barrier_h */
  112. @
  113.  
  114.  
  115. 3.1
  116. log
  117. @Steay version
  118. @
  119. text
  120. @@
  121.  
  122.  
  123. 1.3
  124. log
  125. @*** empty log message ***
  126. @
  127. text
  128. @d22 1
  129. a22 1
  130.     short count;
  131. d38 11
  132. a50 3
  133.     void rendezvous();
  134.  
  135. //    virtual void classPrintOn(ostream&);
  136. d58 1
  137. a58 1
  138.     count = 0;
  139. a65 6
  140. }
  141.  
  142. inline void
  143. Barrier::height(int h)
  144. {
  145.     pHeight = h;
  146. @
  147.  
  148.  
  149. 1.2
  150. log
  151. @*** empty log message ***
  152. @
  153. text
  154. @d1 6
  155. d17 1
  156. a17 1
  157. #include "HardSpinLock.h"
  158. d20 1
  159. a20 1
  160.     HardSpinLock lock;
  161. d35 1
  162. a35 1
  163.     Barrier(int height, int loops);
  164. d42 1
  165. a42 1
  166.     virtual void classPrintOn(ostream&);
  167. @
  168.  
  169.  
  170. 1.1
  171. log
  172. @Initial revision
  173. @
  174. text
  175. @d1 2
  176. a2 2
  177. #ifndef BARRIERH
  178. #define BARRIERH
  179. a5 11
  180. //
  181. //    This implements a barrier synchronizer. Each barrier has a value
  182. //    known as the tripCount. When a barrier is release tripCount times,
  183. //    the barrier is down.
  184. //
  185. //    When a barrier is lowered, all waiting processes are released and
  186. //    the barrier is raised again.
  187. //
  188. //    If no process is waiting, the first process to reserve the barrier
  189. //    raises the barrier as it leaves.
  190. //
  191. d17 2
  192. d29 1
  193. a29 1
  194.     Barrier(int h);
  195. d40 1
  196. a40 1
  197. Barrier::Barrier( int h )
  198. d43 1
  199. d45 1
  200. d60 1
  201. a60 1
  202. #endif BARRIERH
  203. @
  204.